Rails.application.routes.draw do







  devise_for :users,
             class_name: "Admin::User",
             controllers: {
                 sessions: 'admin/users/sessions',
                 registrations: 'admin/users/registrations',
                 passwords: 'admin/users/passwords',
                 confirmations: 'admin/users/confirmations'


             }



  #在正常情况下登录系统后会默认跳转至此处。
  root to: 'posts#index'
  #后台
  namespace :manager do

  #后台管理之博客管理
  namespace :blog do
    resources :blogs
    resources :sorts, only: [:create, :index, :destroy, :new, :edit]
  end
  namespace :theme do
    resource :wms_themes
  end
  #后台
  #用户管理
  namespace :users_bm do
    resources :query_users, except: [:edit, :update, :destroy, :new, :create]
  end


  end





  namespace 'navigation' do
    resources :navigations
  end
  @admin_namespace = 'admin'
  # concern :sessions_con do
  #   resources :sessions, only: [:new, :create, :destroy]
  # end
  #伪命名空间，源码放在admin namespace下，但不需要访问此命名空间。
  # get sign_in => sessions#new
  # delete sign_out/1 => sessions#logout  退出账户
  # post sessions => sessions#create
  # scope module: "#{@admin_namespace}" do
  #
  #   concerns :sessions_con
  # end
  namespace "admin" do
  #   concerns :sessions_con #兼容scope
  #   resources :bm_logins, only: [:new, :create, :show]
  #   resources :users
    get 'welcomes/index', as: :welcome

    namespace "authorize_site" do
      resources :roles, :permissions, :permission_actions, :abilities
    end
  end

  get 'about/show'


  resources :posts, only: [:show, :index]
  get 'classified_query/:id', to: "posts#classified_query"

  get 'recommended_reading', to: "posts#recommended_reading"
  # The priority is based upon order of creation: first created -> highest priority.
  # See how all your routes lay out with "rake routes".

  # You can have the root of your site routed with "root"

  # Example of regular route:
  #   get 'products/:id' => 'catalog#view'

  # Example of named route that can be invoked with purchase_url(id: product.id)
  #   get 'products/:id/purchase' => 'catalog#purchase', as: :purchase

  # Example resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products

  # Example resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end

  # Example resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end

  # Example resource route with more complex sub-resources:
  #   resources :products do
  #     resources :comments
  #     resources :sales do
  #       get 'recent', on: :collection
  #     end
  #   end

  # Example resource route with concerns:
  #   concern :toggleable do
  #     post 'toggle'
  #   end
  #   resources :posts, concerns: :toggleable
  #   resources :photos, concerns: :toggleable

  # Example resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end
end
